package com.chinapex.pipeline;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;
import java.util.*;
import com.aliyuncs.geoip.model.v20200101.*;

/**
 * Hello world!
 *
 */
public class App  {
    public static void main(String[] args) {
        String accessKeyId = "LTAI4GH4tbdvXQwVVPVNx9mg";
        String accessSecret = "0a4NuN8q626L6shH8tDfEPQ0lYRfX3";
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessSecret);
        IAcsClient client = new DefaultAcsClient(profile);

        DescribeIpv4LocationRequest request = new DescribeIpv4LocationRequest();
        request.setIp("221.206.131.10");
        try {
            DescribeIpv4LocationResponse response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());
        }
    }
}
